package com.it135.citytraffic.mapper;

import com.it135.citytraffic.pojo.entity.RoadStatistic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.it135.citytraffic.pojo.entity.RoadTimeStatistic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lh
 * @since 2024-07-10
 */
@Mapper
public interface RoadStatisticMapper extends BaseMapper<RoadStatistic> {



    RoadTimeStatistic selectSimilar(LocalDateTime occurrenceTime, String name, Integer crossingId, String direction, Integer status);

    ArrayList<RoadStatistic> findAll();
    ArrayList<RoadStatistic> findById(Long id);

    @Select("select id,name,direction,status from road_statistic where crossing_id = #{id}")
    List<RoadStatistic> getRS(Long id);

    @Select("select id from road_statistic where crossing_id = #{id} and name = #{name} and direction = #{direction}")
    List<Long> getAllId(Long id, String name, String direction);
}
